package cn.duli.myvideo.service.Impl;

import cn.duli.myvideo.mapper.UserMapper;
import cn.duli.myvideo.pojo.User;
import cn.duli.myvideo.service.UserService;
import com.github.pagehelper.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public Page<User> findAll() {
        return userMapper.findAll();
    }

    @Override
    public void deleteById(Integer uId) {
        userMapper.deleteById(uId);
    }

    @Override
    public boolean findUserByUserName(String uName) {
        User user = userMapper.findUserByUserName(uName);
        return user == null?false:true;
    }

    @Override
    public void save(User user) {
        userMapper.save(user);
    }

    @Override
    public User login(User user) {
        return userMapper.login(user);
    }

    @Override
    public User findByUserName(String uName) {
        return userMapper.findByUserName(uName);
    }

    @Override
    public void update(User user) {
        userMapper.update(user);
    }

    @Override
    public User findPwdByUserName(String uName) {
        return userMapper.findPwdByUserName(uName);
    }

    @Override
    public void updatePwd(User user) {
        userMapper.updatePwd(user);
    }
}
